#include "widget.h"
#include "ui_widget.h"
#include<QPushButton>
#include<QPalette>
#include<QColor>
#include<QPixmap>
Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);setFixedSize(800,600);
    QColor color(255,0,255);
    QPalette p=b3.palette();
    p.setColor(QPalette::Button,color);
    b3.setPalette(p);
    b1.setParent(this);
    b1.setText("关闭");
    b1.move(600,300);
    b3.setParent(this);


    b3.setText("困难模式");
    b3.move(200,300);


    connect(&b3,&QPushButton::released,this,&Widget::change);
    connect(&b1,&QPushButton::pressed,this,&Widget::close);
}

Widget::~Widget()
{
    delete ui;
}
void Widget::change (){
    w.show();
    this->hide();
}
void Widget::paintEvent(QPaintEvent *event){
    Q_UNUSED(event);
    QPixmap pixmap=QPixmap(":/res/b5f371d6e03b417cc5d0ba5ca2b8d7b.jpg").scaled(this->size());
    QPainter painter(this);
    painter.drawPixmap(this->rect(),pixmap);
}

